/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package cp3120_p;

import java.sql.Connection;
import java.sql.DriverManager;
import javax.swing.JOptionPane;


public class DAO {
    private Connection connection;
    public DAO()
    {
        InitDAO();
    }
    private boolean InitDAO() {
        try {
            Class.forName("com.mysql.jdbc.Driver");
            connection = DriverManager.getConnection(
                    "jdbc:mysql://localhost:3306/cp3120_p", "root", "root");

            return true;

        } catch (Exception e) {
            JOptionPane.showMessageDialog(null, "Can not Connection with DB");
            e.printStackTrace();
            connection = null;
            return false;
        }
    }

    public Connection getConnection() {
        return connection;
    }

}
